import { IncomingHttpHeaders } from 'http';

import query from '@dfeidao/atom-nodejs/db/query';
import { productid,systemid } from '../../atom/config';
interface Message {
	filter: {
		exam_id: string
	};
	// cookie: {
	// 	uk: string;
	// 	[key: string]: string
	// };
	// urls: {
	// 	base: string;
	// 	origin: string;
	// 	url: string;
	// };
	// query: {};
	// params: {};
	// headers: {};
	// captcha: string;
}
/*表名	exam_paper
标题	考试试卷
字段名称	字段标题	字段类型	字段长度	是否为空	是否主键
exam_score	考试分数	string	20	ⅹ	ⅹ
exam_id	考试编号	string	50	√	ⅹ
exam_time	考试时间	timestamp	50	ⅹ	ⅹ
candidate_no	考生编号	string	50	ⅹ	ⅹ
paper_number	试卷编号	string	50	√	ⅹ
_id	id	string	50	ⅹ	√
productid	产品ID	string	50	√	ⅹ
 */
export default async function atom(message: Message, action_id: string, session_id: string, headers: IncomingHttpHeaders) {
	const { prepare, exec } = query(action_id, session_id, systemid);
	prepare('exam_paper', ['exam_score', 'paper_number'], { productid, exam_id: message.filter.exam_id }, 200, 1, [], []);

	const [dt] = await exec();
	return { dt };
}
